<template>
  <div class="appGoodsActive-container">
    <van-goods-action>
      <van-goods-action-icon
        :icon="isCollected ? 'star' : 'star-o'"
        :text="isCollected?'已收藏':'未收藏'"
        :color="isCollected ? 'orange':'#666'"
        @click="isCollected = !isCollected"
      />
      <van-goods-action-icon icon="cart-o" text="购物车" :badge="cartCount" />
      <van-goods-action-button
        color="#be99ff"
        type="warning"
        text="加入购物车"
        @click="addToCart"
      />
      <van-goods-action-button color="#7232dd" type="danger" text="立即购买" @click="buy" />
    </van-goods-action>
  </div>
</template>

<script>
export default {
  name: 'APPGoodsActive',
  props: {
    // 购物车商品数量
    cartCount: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      isCollected: false
    }
  },
  methods: {
    // 点击购买商品
    buy() {
      this.$toast.fail('该功能尚未开发')
    },
    // 点击加入购物车
    addToCart() {
      this.$emit('addToCart')
    }
  },
  created() {
  }
}
</script>

<style lang="less" scoped>
  .van-goods-action {
    z-index: 9999999;
  }
</style>
